from pydantic import BaseModel, Field
from typing import Union, TypeVar, Generic, Optional,Any,List


class TestReq(BaseModel):
    name:str=Field(...,description="姓名")
    price:Optional[float]=Field(...,description="价格")


class PreEvaluateData(BaseModel):
    mainSpan: Optional[str]=None
    girderType: Optional[str]=None
    mainBeamType: Optional[str]=None
    towerNumber: Optional[str]=None
    towerHeight: Optional[str]=None

class MeasureAnalysisData(BaseModel):
    sample_type: Optional[int]=None
    sample_urls: Optional[List[str]]=None
    sample_frequency: Optional[str]=None
    epsg: Optional[str]=None

class CaeData(BaseModel):
    spans:str=None
    width:str=None
    beam_type:Optional[str]=None
    bridge_year:Optional[str]=None

    cable_plane_num:Optional[str]=None
    cable_num:Optional[str]=None

    tower_vertical_type:Optional[str]=None
    tower_horizontal_type:Optional[str]=None
    tower_h_ratio:Optional[str]=None
    tower_h_1:Optional[str]=None

    auxi_col_num:Optional[str]=None

    girder_type:Optional[str]=None
    girder_mat:Optional[str]=None

    column_num: Optional[str] = None
    column_h: Optional[str] = None


class AnalysisReq(BaseModel):
    recordId:Optional[int]=None
    bridgeType:Optional[int]=None
    bridgeName:Optional[str]=None
    bridgeCode:Optional[str]=None

    measure:MeasureAnalysisData=None
    cae:CaeData=None
    preEvaluate:PreEvaluateData=None


T =TypeVar("T")
class TestResp(BaseModel,Generic[T]):
    code:int
    message:str
    data:T